<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <f:view>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Facturaci&oacute;n</title>
            <link type="text/css" href="../common/css/redmond/jquery-ui-1.8.23.custom.css" rel="stylesheet" />
            <link type="text/css" href="../common/css/administrar.css" rel="stylesheet" />
            <link type="text/css" href="../common/css/ui.panel.css" rel="stylesheet" />
            <link type="text/css" href="../common/css/interface-fisheye.css" rel="stylesheet" />
            <script type="text/javascript" src="../common/js/jquery-1.4.2.min.js"></script>
            <script type="text/javascript" src="../common/js/jquery.ui.all.js"></script>
            <script type="text/javascript" src="../common/js/jquery.layout.js"></script>
            <script type="text/javascript" src="../common/js/jquery-ui-1.8.6.custom.min.js"></script>
            <script type="text/javascript" src="../common/js/jquery-ui-timepicker-addon.js"></script>
            <script type="text/javascript" src="../common/js/calendarioui-es.js"></script>
            <script type="text/javascript" src="../common/js/jquery.dateentry.js"></script>
            <script type="text/javascript" src="../common/js/admision.js"></script>
            <script type="text/javascript" src="../common/js/jquery.validate.js"></script>
            <script type="text/javascript" src="../common/js/messages_es.js"></script>
            <script type="text/javascript" src="../common/js/ui.panel.js"></script>
            <script type="text/javascript" src="../common/js/jquery.qtip-1.0.0-rc3.js"></script>        
            <script type="text/javascript" src="../common/js/interface.js"></script>
            <script type="text/javascript" src="../common/js/jquery.timeentry.js"></script>
            <script type="text/javascript" src="../common/js/jquery.pagination.js"></script>
            <script type="text/javascript" src="../common/js/jquery.contextMenu.js"></script>
            <link type="text/css" href="../common/css/jquery.contextMenu.css" rel="stylesheet" />
            <link type="text/css" href="../common/css/pagination.css" rel="stylesheet" />
            <script type="text/javascript" src="../common/js/jquery.qtip-1.0.0-rc3.js"></script>
            <link type="text/css" href="../common/css/jquery.timeentry.css" rel="stylesheet" />


            <script type="text/javascript">
	
                $(document).ready(
                function()
                {
                    $('#fisheye').Fisheye(
                    {
                        maxWidth: 120,
                        items: 'a',
                        itemsText: 'span',
                        container: '.fisheyeContainter',
                        itemWidth: 100,
                        proximity: 120,
                        halign : 'center'
                    }
                )
			
                }
            );

            </script>





        </head>
        <body>   

            <div id="camposOcultosValidacion" style="display: none">

                <input type="hidden" id="idadmision" value="0"/>
                <input type="hidden" id="iddetalleadmision" value="0"/>
                <input type="hidden" id="espyp" value="0"/>
                <input type="hidden" id="idplaneacionpyp" value="0"/>
                <input type="hidden" id="idCita" value="0"/>
            </div>

            <div id="acttemp" style="display: none">
                <input type="text" id="vrempresatmp" value="0"/>
                <input type="text" id="vrpacientetmp" value="0"/>  
                <input type="text" id="idusuario" value="1"/>
                <input type="text" id="idprestador" value="1"/>
            </div>






            <div id="fisheye" class="fisheye">
                <center>
                    <h1 style="color: gray">Admisi&oacute;n de Usuarios</h1>
                </center>

                <br />
                <div class="fisheyeContainter">
                    <a href="#" id="adm_consultaext" class="fisheyeItem"><img src="../common/img/vacunacion.png" width="50"/><span>Consulta externa</span></a>			
                    <a href="#" id="adm_ambulatoria" class="fisheyeItem"><img src="../common/img/vacunacion.png" width="50"/><span>Ambulatoria</span></a>			
                    <a href="#" id="adm_urgencias" class="fisheyeItem"><img src="../common/img/urgencias.png" width="50"/><span>Urgencias</span></a>			
                    <a href="#" id="adm_hospitalizacion" class="fisheyeItem"><img src="../common/img/hospitalizacion.png" width="50"/><span>Hospitalizaci&oacute;n</span></a>                            

                </div>
            </div>

            <div style="display: none " id="pantalla-factura">


                <div style="width: 100%; text-align: center;">

                    <table width="100%">
                        <tr>
                            <td  class="ui-state-hover" align="left">    
                                Admisi&oacute;n de Usuarios&nbsp;&nbsp;<b style="color:green;width: 230px" id="txt-servicio"></b>
                            </td>
                            <td class="ui-state-hover" align="right">
                                <button id="configBtn">Config</button>               
                            </td>
                            <td class="ui-state-hover" align="right">                            
                                <button id="ayudaBtn">Ayuda</button>               
                            </td>
                        </tr>
                    </table>

                    <div class="tooltips"></div> 


                    <form id="form-factura">

                        <div id="panel1">

                            <h4>
                                Datos del paciente
                            </h4>


                            <table width="100%">

                                <tr>                                    
                                    <td>
                                        Fecha
                                    </td>

                                    <td>
                                        Identificaci&oacute;n / TD
                                    </td>

                                    <td>
                                        Nombre Completo
                                    </td>

                                    <td>
                                        Edad
                                    </td>

                                    <td>
                                        Sexo 
                                    </td>    

                                    <td>
                                        Regimen
                                    </td>

                                    <td>
                                        Nivel
                                    </td>

                                    <td>
                                        T. Afiliaci&oacute;n
                                    </td>                                                                       

                                    <td style="display: none">
                                        Tipo Poblac&oacute;on
                                    </td>

                                    <td style="display: none">
                                        Tipo Paciente
                                    </td>

                                </tr>

                                <tr> 
                                    <td>
                                        <input type="text" size="7" readonly="true" id="fecfac" value=""/>    
                                    </td>  

                                    <td>
                                        <table>
                                            <tr>

                                                <td>
                                                    <input type="text" size="10" ondblclick="buscarPacienteCodigo()" maxlength="20" id="identificacion" value=""/>
                                                    <input type="hidden" id="idpaciente" name="idpaciente" value="" />
                                                    <input type="hidden" id="idmanual" value="" />

                                                    <!--se sobreescribe con idcps-->
                                                    <input type="hidden" id="idcontrato" value="" />
                                                </td>

                                                <td><select readonly ="true"  id="id_tipo_ide" name="id_tipo_ide" class="ui-widget-content"></select></td>

                                                <td>                                        
                                                    <img src="../common/img/user_search.png"  onclick="buscarPacienteCodigo()" style="cursor: pointer" alt="buscarPaciente" />                                                    
                                                </td>

                                                <td>
                                                    <img src="../common/img/edit-clear.png" onclick="clearPacientecodigo()" style="cursor: pointer" alt="Eliminar" /> 
                                                </td>
                                            </tr>
                                        </table>
                                    </td>


                                    <td>
                                        <input type="text" size="40" readonly="true" id="nombres" value="" />

                                    </td>

                                    <td>
                                        <input type="text" size="1" readonly="true" id="edad" value=""/>

                                    </td>


                                    <td>
                                        <input type="text" size="1" readonly="true" id="sexo" value=""/>

                                    </td>
                                    <td>
                                        <input type="text" size="11" readonly="true" id="regimen" value=""/>

                                    </td>

                                    <td>
                                        <input type="text" size="1" readonly="true" id="nivel" value=""/>

                                    </td>

                                    <td>
                                        <input type="text" size="6" readonly="true" id="tipoafiliado" value=""/>

                                    </td>
                                    <td style="display: none">
                                        <input type="text" size="1" readonly="true" id="tipoPoblacion" value=""/>

                                    </td>

                                    <td style="display: none">
                                        <input type="text" size="1" readonly="true" id="tipoPaciente" value=""/>

                                    </td>

                                </tr>

                            </table>
                        </div>


                        <div id="panel2">

                            <h4>Convenios / Contratos</h4>
                            <table width="100%" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td style="display: none">
                                        Servicio/Ubicaci&oacute;n
                                    </td>

                                    <td>
                                        Administradora
                                    </td>

                                    <td>
                                        Contratos Disponibles
                                    </td>
                                    <td>
                                        Tarifario
                                    </td> 

                                    <td style="display:none">>
                                        M&eacute;dico Atiende
                                    </td>

                                </tr>

                                <tr>
                                    <td>
                                        <select style="width: 450px" id="idadministradora" name="idadministradora" class="text ui-widget-content"></select>
                                    </td>

                                    <td>
                                        <select style="width: 370px" id="idcps" name="idcps" class="text ui-widget-content"></select>
                                    </td>
                                    <td>
                                        <input type="text" size="16" readonly="true" id="tarifario" value=""/>
                                    </td>         

                                    <td>
                                        <table>
                                            <tr>
                                                <td style="display:none">
                                                    <select style="width: 240px" id="idmedico" name="idmedico" class="text ui-widget-content"></select>
                                                </td>
                                                <td>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>

                                </tr>           


                            </table>

                        </div>


                        <div id="panel3">
                            <h4>Servicios (APIs)</h4>

                            <table width="100%" cellpadding="0" cellspacing="0">

                                <tr>             

                                    <td>
                                        Autorizaci&oacute;n
                                    </td>

                                    <td>
                                        Tipo Cuota/ TD
                                    </td>

                                    <td>
                                        Valor cuota
                                    </td>                            

                                </tr>
                                <tr>
                                    <td>
                                        <input type="text" size="15" id="autorizacion" name="autorizacion" value=""/>  
                                    </td>

                                    <td>                                        
                                        <select style="width: 370px" id="tipocuota" name="tipocuota" class="text ui-widget-content"></select>    
                                    </td>

                                    <td>
                                        <input type="text" size="10" id="valorcuota" name="valorcuota" value=""/>
                                    </td>

                                </tr>


                            </table>
                        </div>


                        <div id="panel4">
                            <h4>Datos Acompañante</h4>
                            <div>
                                <table id="res" class='ui-widget-content' width="100%">

                                    <tr>                                    

                                        <td>
                                            Identificaci&oacute;n / TD
                                        </td>

                                        <td>
                                            Nombre Completo
                                        </td>

                                        <td>
                                            Direcci&oacute;n
                                        </td>

                                        <td>
                                            Tel&eacute;fono
                                        </td>

                                    </tr>

                                    <tr> 
                                        <td>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <input type="text" size="10" ondblclick="buscarPacienteCodigo()" maxlength="20" id="identificacion" value=""/>
                                                        <input type="hidden" id="idpaciente" name="idpaciente" value="" />
                                                        <input type="hidden" id="idmanual" value="" />

                                                    </td>

                                                    <td><select readonly ="true"  id="acid_tipo_ide" name="acid_tipo_ide" class="ui-widget-content"></select></td>

                                                    <td>                                        
                                                        <img src="../common/img/user_search.png"  onclick="buscarPacienteCodigo()" style="cursor: pointer" alt="buscarPaciente" />                                                    
                                                    </td>

                                                    <td>
                                                        <img src="../common/img/edit-clear.png" onclick="clearPacientecodigo()" style="cursor: pointer" alt="Eliminar" /> 
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>


                                        <td>
                                            <input type="text" size="40" readonly="true" id="acnombres" value="" />

                                        </td>

                                        <td>
                                            <input type="text" size="30" readonly="true" id="acdireccion" value=""/>

                                        </td>


                                        <td>
                                            <input type="text" size="10" readonly="true" id="actelefono" value=""/>

                                        </td>

                                    </tr>
                                </table>

                            </div>

                        </div>


                        <div id="panel5">
                            <h4>Datos Remite</h4>

                            <div>
                                <table id="res" class='ui-widget-content' width="100%">

                                    <tr>                                    

                                        <td>
                                            C&oacute;digo
                                        </td>

                                        <td>
                                            Nombre Completo
                                        </td>



                                    </tr>

                                    <tr> 
                                        <td>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <input type="text" size="10" ondblclick="buscarPacienteCodigo()" maxlength="20" id="identificacion" value=""/>
                                                        <input type="hidden" id="idpaciente" name="idpaciente" value="" />

                                                    </td>


                                                    <td>                                        
                                                        <img src="../common/img/user_search.png"  onclick="buscarPacienteCodigo()" style="cursor: pointer" alt="buscarPaciente" />                                                    
                                                    </td>

                                                    <td>
                                                        <img src="../common/img/edit-clear.png" onclick="clearPacientecodigo()" style="cursor: pointer" alt="Eliminar" /> 
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>


                                        <td>
                                            <input type="text" size="40" readonly="true" id="rmnombres" value="" />

                                        </td>


                                    </tr>









                                    <tr>                                    

                                        <td>
                                            Identificaci&oacute;n / TD
                                        </td>

                                        <td>
                                            Nombre Completo
                                        </td>

                                        <td>
                                            Direcci&oacute;n
                                        </td>

                                        <td>
                                            Tel&eacute;fono
                                        </td>

                                    </tr>

                                    <tr> 
                                        <td>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <input type="text" size="10" ondblclick="buscarPacienteCodigo()" maxlength="20" id="identificacion" value=""/>
                                                        <input type="hidden" id="idpaciente" name="idpaciente" value="" />
                                                        <input type="hidden" id="idmanual" value="" />

                                                    </td>

                                                    <td><select readonly ="true"  id="rmid_tipo_ide" name="rmid_tipo_ide" class="ui-widget-content"></select></td>

                                                    <td>                                        
                                                        <img src="../common/img/user_search.png"  onclick="buscarPacienteCodigo()" style="cursor: pointer" alt="buscarPaciente" />                                                    
                                                    </td>

                                                    <td>
                                                        <img src="../common/img/edit-clear.png" onclick="clearPacientecodigo()" style="cursor: pointer" alt="Eliminar" /> 
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>


                                        <td>
                                            <input type="text" size="40" readonly="true" id="rmnombres" value="" />

                                        </td>

                                        <td>
                                            <input type="text" size="30" readonly="true" id="rmdireccion" value=""/>

                                        </td>


                                        <td>
                                            <input type="text" size="10" readonly="true" id="rmtelefono" value=""/>

                                        </td>

                                    </tr>
                                </table>

                            </div>


                        </div>

                    </form>     




                </div>

                <center>

                    <button id="grabarBtn" onclick="abrirdialogoRips()"> Grabar</button>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;





                    <!-- esperar para liquidar la factura, despues de los descuentos realizados.-->
                    <button id="liquidarBtn" onclick="enviarDatosBd()"> Liquidar</button>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                    <button id="cancelarBtn" size="40" onclick="cancelarFactura()"> Cancelar</button>  

                </center>


            </div><!--pantalla admision-->


            <!--BUSCADORES-->

            <!--Buscar Actividades-->
            <div id="dialogoBuscar" style="display: none" title="ACTIVIDADES">
                <br />
                <div id="busquedaDiv">
                    <table width="100%">
                        <tr class="ui-widget-header">
                            <td>C&oacute;digo</td>
                            <td>
                                <input type="text" onkeyup="this.value=this.value.toUpperCase()" id="codigoBusq" size="16" maxlength="16"/>
                            </td>
                            <td>Descripci&oacute;n</td>
                            <td>
                                <input type="text" onkeyup="this.value=this.value.toUpperCase()" id="descBusq" size="45" maxlength="45"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" align="center">
                                <input class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"  id="buscar" type="button" value="Buscar"/>
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="datos" style="display: none">
                </div>

            </div>

            <!--Buscar Pacientes-->
            <div id="dialogoBuscarPac" style="display: none" title="PACIENTES">


                <div id="busquedaDivPac">
                    <table width="100%">
                        <tr class="ui-widget-header">
                            <td>
                                Identificaci&oacute;n
                            </td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr class="ui-widget-header">                    
                            <td>
                                <input onkeyup="validarBusquedaPac(1)" type="text" id="ide" size="16" maxlength="16"/>
                            </td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>

                        <tr class="ui-widget-header">

                            <td>Primer Nombre</td>
                            <td>Segundo Nombre</td>
                            <td>Primer Apellido</td>
                            <td>Segundo Apellido</td>
                        </tr>
                        <tr>                    
                            <td>
                                <input onkeyup="this.value=this.value.toUpperCase();validarBusquedaPac(2)" type="text" id="n1" size="15" maxlength="20"/>
                            </td>
                            <td>
                                <input onkeyup="this.value=this.value.toUpperCase();validarBusquedaPac(2)" type="text" id="n2" size="15" maxlength="20"/>
                            </td>
                            <td>
                                <input onkeyup="this.value=this.value.toUpperCase();validarBusquedaPac(2)" type="text" id="a1" size="15" maxlength="20"/>
                            </td>
                            <td>
                                <input onkeyup="this.value=this.value.toUpperCase();validarBusquedaPac(2)" type="text" id="a2" size="15" maxlength="20"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="5" align="center">
                                <input class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="buscarPac" type="button" value="Buscar"/>
                            </td>
                        </tr>

                    </table>
                </div>
                <div id="datosPac" style="display: none">
                </div>

            </div>





            <!--Buscar Servicio Ubicacion-->
            <div id="dialogoBuscarServ" style="display: none" title="SERVICIOS">


                <br />
                <div id="busquedaDivServ">
                    <table>
                        <tr>
                            <td>C&oacute;digo</td>
                            <td>
                                <input type="text" id="codigoBusqServ" size="2" maxlength="2"/>
                            </td>
                            <td>Descripci&oacute;n</td>
                            <td>
                                <input type="text" id="descBusqServ" size="25" maxlength="25"/>
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="datosServ" style="display: none">
                </div>
            </div>

            <!--ACTIVIDADES DE CONSULTA-->
            <div id="dialogoBuscarConsulta" style="display: none" title="CONSULTAS">        
                <select style="width: 230px" id="idconsulta" name="idconsulta" class="text ui-widget-content"></select>
            </div>


            <!--Buscar Servicio Medico-->
            <div id="dialogoBuscarMed" style="display: none" title="MEDICOS">

                <div id="busquedaDivMed">
                    <table>
                        <tr>
                            <td>Identificaci&oacute;n</td>
                            <td>Nombre</td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" id="codigoBusqMed" size="20" maxlength="20"/>
                            </td>

                            <td>
                                <input type="text" id="descBusqMed" size="50" maxlength="50"/>
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="datosMed" style="display: none">
                </div>
            </div>


            <!--dialogo liquidacion de factura-->
            <div id="dialogoLiquidarFactura" style="display: none" title="LIQUIDACION DE FACTURA">
            </div>

            <!--dialogo rips-->
            <div id="dialogoRips" style="display: none" title="RIPS">
            </div>

            <!--dialogo confirmar rips-->
            <div id="dialogoConfirmaRips" style="display: none" title="Informacion">
                Desea ingresar el rips para la factura?
            </div>

            <!--dialogo confirmar CAJA-->
            <div id="dialogoConfirmaImpresion" style="display: none" title="Informacion">     
            </div> 

            <div id="citas-form" title="Info" style="display: none"></div>

            <!--DIALOGO CONFIGURACION-->
            <div id="dialogoConfiguracion" title="Configuracion" style="display: none">
            </div>


            <!--ACTIVIDADES DE LA ADMISION-->
            <div id="dialogoActividadesCargadasAdmision" style="display: none" title="ACTIVIDADES DE LA ADMISION">        
                <select style="width: 230px" id="idactix" name="idactix" class="text ui-widget-content"></select>
            </div>






        </body>
    </f:view>
</html>
